
<div class="container">	
<style>
.tools{text-align:center;height:62px;}
</style>

<div class="clearfix" style="margin-top:10px;color:#999;font-size: 14px;">
<!-- 
<div class="pull-right">
	<a href="javascript:void(0)" class="btn btn-warning btn-sm" onclick="if(confirm('确认要收藏本页所有样式？需要积分收藏的将自动扣除积分')) $('.btn-favorite').trigger('click');">一键收藏本页所有样式</a>
</div> -->
<?php 
function is_wechat_gif($url){
	if(strpos($url,'http://image1.135editor.com/cache/remote/') !== false) {
		$source_url = base64_decode(substr($url,41));
		if(substr($source_url,-10) == 'wx_fmt=gif'){
			return $source_url;
		}
	}
	return false;
}
?>	
		<ul class="nav nav-tabs">
			<li><a href="/little_app">全部</a></li>
<li {{if $_GET['tag_id']==1114 }}class="active"{{/if}}><a href="/little_app?tag_id=1114">新闻</a></li>
<li {{if $_GET['tag_id']==935 }}class="active"{{/if}}><a href="/little_app?tag_id=935">工具</a></li>
<li {{if $_GET['tag_id']==47 }}class="active"{{/if}}><a href="/little_app?tag_id=47">旅游</a></li>
<li {{if $_GET['tag_id']==1112 }}class="active"{{/if}}><a href="/little_app?tag_id=1112">社交</a></li>
<li {{if $_GET['tag_id']==1113 }}class="active"{{/if}}><a href="/little_app?tag_id=1113">生活</a></li>
<li {{if $_GET['tag_id']==1111 }}class="active"{{/if}}><a href="/little_app?tag_id=1111">商务</a></li>
<li {{if $_GET['tag_id']==93 }}class="active"{{/if}}><a href="/little_app?tag_id=93">购物</a></li>
<li {{if $_GET['tag_id']==1110 }}class="active"{{/if}}><a href="/little_app?tag_id=1110">娱乐</a></li>
<li {{if $_GET['tag_id']==488 }}class="active"{{/if}}><a href="/little_app?tag_id=488">美食</a></li>		
		</ul>	
</div>

<div style="color:#999;margin:5px 0;" class="form-inline"> 排序方式：
	  <select id="sort-type" class="form-control" style="margin:3px 0px;padding: 0 10px;display: inline-block;width: auto;height: 33px">
	  	<option {{if empty($_REQUEST['order'])||$_REQUEST['order']=='id'}}selected{{/if}} value="id">添加时间</option>
	  	<option {{if $_REQUEST['order']=='view_nums'}}selected{{/if}} value="view_nums">点击量</option>
	  </select>
	  <div style="display:inline-block;margin-left:20px;">
		<form method="get" action="{{getSearchLinks($this->request,array(),array('name','page','tag_id'))}}">
			{{loop $_GET $k $v}}
				<?php if($k=="name" || $k=='page') continue; ?>
				<input type="hidden" name="{{$k}}" value="{{$v}}">
			{{/loop}}
	  	<input type="text" style="height:33px;line-height:33px;padding:0 10px;" value="{{$_GET['name']}}" name="name" class="form-control"> <button class="btn btn-default btn-sm" type="submit"> <i class="fa fa-search"></i> 搜索</button>
	  </form>
  	</div>

  	<a class="btn btn-primary btn-sm" style="width:180px;" href="/little_apps/add">提交小程序</a>
</div>
		<div class="row">
				    <?PHP foreach($Category['datalist'] as $key => $item) {
						$item['slug'] = $item['slug']?$item['slug']:$item['id'];
    				?>	
<div class="col-md-2 col-sm-3 col-xs-6"><!-- start style-list -->
	<a href="javascript:;" data-id="{{$item['id']}}" class="little-app-item" role="button" data-title="预览小程序" id="little-app-{{$item['id']}}" style="display:block;cursor:pointer;border:1px solid #ccc;border-radius:5px;margin-bottom:20px;color:#666;text-decoration: none;" {{if $item['qrcode']}} data-content="<img style='width: 150px;' src='{{$item['qrcode']}}'><p style='text-align:center;'>扫码体验</p>" {{else}} data-content="<p>暂无二维码，请搜索名称体验</p>" {{/if}}>
		<div class="content" >
			<div style="text-align:center;margin:10px 0;height: 90px;">
			<?PHP 
				if($item['coverimg']){
					echo $this->Html->image('/img/grey.gif', array('class'=>'lazy','data-src'=>$item['coverimg'], 'title'=>$item['name'],'style'=>'width:90px;border-radius: 50%;'));
				}
			?>
			</div>			
		</div>
		<div class="tools clearfix">
			 <p style="white-space: pre;margin: 0 0;font-weight:normal;font-size: 16px;text-align: center;">{{$item['name']}}</p>
			 
			 {{if $data_tags[$item['id']]}}
					<p style="margin: 0 0;"><small>
					{{loop $data_tags[$item['id']] $tid}}
						<?PHP if(empty($tid)) continue; ?>
						{{$all_tags[$tid]}} &nbsp;
						
					{{/loop}}
					</small></p>
				
				{{/if}}
			 <small>点击数：{{$item['view_nums']}}</small>
		</div>
	</a>	
</div>
				<?php } ?>
		</div>
		{{$page_navi}}
</div>
<div class="container"  style="background: #FFF;">	
	<portlet title="友情链接" model="Link" limit="60" conditions="published=1" list_tpl="inner">
		
		<a href="{{$item['link_url']}}" title="{{$item['name']}}" style="line-height:40px;height:40px;display:inline-block;margin:5px;" target="_blank">
			{{if $item['link_img']}}
			<img src="{{$item['link_img']}}" alt="{{$item['name']}}" style="height:40px;">
			{{else}}
				{{$item['name']}}
			{{/if}}
		</a>
	</portlet>
	<p><small>更多友情链接交换中，请与管理员联系</small></p>
</div>
<script>
$(function(){
	$('.little-app-item').popover({
		'trigger':'focus',
		'html':true,
		'placement':'bottom',
		'container':'body'
	});
	$('.little-app-item').on('show.bs.popover',function(){
		if( ! $(this).data('clicked') ){
			$(this).data('clicked',true);
			ajaxAction('/little_apps/view/'+$(this).data('id')+'.json');
		}
		
	});
	$('#sort-type').change(function(){
		var url = "{{getSearchLinks($this->request,array(), array('order'))}}";
		if(url.indexOf('?') > 0){
			url = url + '&order='+this.value;
		}
		else{
			url = url + '?order='+this.value;
		}
		window.location.href = url;
	})
})
</script>